from akshare import fund_etf_category_sina
import pandas as pd
import os 




#####################
def get_etf_codes(root=None) -> None:
    if root is None:
        root = r"data/etf_data/code_date"
    if not os.path.exists(root):
        os.makedirs(root)
    fund_etf_fund_daily_em_df = fund_etf_category_sina(symbol="ETF基金") 
    print(fund_etf_fund_daily_em_df)
    fund_etf_fund_daily_em_df.to_csv( os.path.join(root, "etf_codes.csv"), encoding="utf-8", index=False )

